<template>
	<div class="app-container">
		<!-- <div style="margin: 30px 0 0px 0;text-align: right;">
			<el-button type="warning" plain icon="el-icon-check" :disabled="canSubmit" size="mini" @click="submitCheck" v-hasPermi="['teacher:achievementcheck:add']">提交今年成果绩效</el-button>
		</div> -->
		<el-tabs type="border-card">
			<el-tab-pane label="基础信息">
				<!-- 添加或修改basicMessage对话框 -->
				<!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> -->
				<el-form ref="form" :model="form" size="small" :inline="true" :rules="rules" label-width="80px">
					<div>
						<div style="width: 10px;height: 50px;background-color: #0072C6;display: inline-block;"></div>
						<span style="font-size: 24px;font-weight: bold;margin-left: 35px;line-height: 50px;">基础信息</span>
					</div>
					<el-form-item label="照片" prop="photo">
						<image-upload v-model="form.photo" />
					</el-form-item>
					<br>
					
					<el-form-item label="姓名" prop="name">
						<el-input v-model="form.name" placeholder="请输入姓名" />
					</el-form-item>
					<el-form-item label="性别" prop="gender" style="margin-left: 180px;">
						<el-radio v-model="form.gender" label="0">男</el-radio>
						<el-radio v-model="form.gender" label="1">女</el-radio>
					</el-form-item>
					<el-form-item label="手机号码" prop="phone" style="margin-left: 180px;">
						<el-input v-model="form.phone" type="textarea" placeholder="请输入内容" />
					</el-form-item>

					<br>
					<el-form-item label="出生年月" prop="birthday">
						<el-date-picker clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd"
							placeholder="请选择出生年月">
						</el-date-picker>
					</el-form-item>

					<el-form-item label="民族" prop="nation" style="margin-left: 160px;">
						<el-select v-model="form.nation" placeholder="请选择民族">
							<el-option v-for="dict in dict.type.rt_nation" :key="dict.value" :label="dict.label"
								:value="dict.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="通讯地址" prop="address" style="margin-left: 70px;">
						<el-input v-model="form.address" placeholder="请输入通讯地址" />
					</el-form-item>
					<br>
					<el-form-item label="政治面貌" prop="political">
						<el-select v-model="form.political" placeholder="请选择政治面貌">
							<el-option v-for="dict in dict.type.rt_political" :key="dict.value" :label="dict.label"
								:value="dict.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="微信账号" prop="wechat" style="margin-left: 165px;">
						<el-input v-model="form.wechat" placeholder="请输入微信账号" />
					</el-form-item>
					<el-form-item label="婚姻状况" prop="marriage" style="margin-left: 85px;">
						<el-radio v-model="form.marriage" label="已婚">已婚</el-radio>
						<el-radio v-model="form.marriage" label="未婚">未婚</el-radio>

					</el-form-item>

					<br>
					<el-form-item label="身份证号码" prop="identity">
						<el-input v-model="form.identity" type="textarea" placeholder="请输入内容" />
					</el-form-item>
					<el-form-item label="QQ号码" prop="qqnumber" style="margin-left: 190px;">
						<el-input v-model="form.qqnumber" type="textarea" placeholder="请输入内容" />
					</el-form-item>

					<div>
						<div style="width: 10px;height: 50px;background-color: #0072C6;display: inline-block;"></div>
						<span style="font-size: 24px;font-weight: bold;margin-left: 35px;line-height: 50px;">岗位信息</span>
					</div>

					<el-form-item label="其他职务" prop="anotherDuties">
						<el-input v-model="form.anotherDuties" placeholder="请输入其他职务" />
					</el-form-item>
					<el-form-item label="二级单位" prop="level2units" style="margin-left: 180px;">
						<el-input v-model="form.level2units" placeholder="请输入二级单位" />
					</el-form-item>
					
					<el-form-item label="学院" prop="college" style="margin-left: 80px;">
						<el-select v-model="form.college" placeholder="请选择学院">
							<el-option v-for="dict in dict.type.rt_filling_college" :key="dict.value" :label="dict.label"
								:value="dict.value"></el-option>
						</el-select>
					</el-form-item>
					<br>
					<el-form-item label="担任辅导员时间" prop="serviceHours">
						<el-input v-model="form.serviceHours" placeholder="请输入担任辅导员时间" />
					</el-form-item>
					<el-form-item label="岗位性质" prop="jobNature" style="margin-left: 180px;">
						<el-select v-model="form.jobNature" placeholder="请选择岗位性质">
							<el-option v-for="dict in dict.type.rt_nature" :key="dict.value" :label="dict.label"
								:value="dict.value"></el-option>
						</el-select>
					</el-form-item>
					<br>
					<el-form-item label="参加工作时间" prop="joinWorkHours">
						<el-input v-model="form.joinWorkHours" placeholder="请输入参加工作时间" />
					</el-form-item>
					<el-form-item label="最高学历" prop="highestEducation" style="margin-left: 180px;">
						<el-input v-model="form.highestEducation" placeholder="请输入最高学历" />
					</el-form-item>
					<el-form-item label="毕业院校" prop="educated" style="margin-left: 80px;">
						<el-input v-model="form.educated" placeholder="请输入毕业院校" />
					</el-form-item>
					<br>
					<el-form-item label="专业" prop="study">
						<el-input v-model="form.study" placeholder="请输入专业" />
					</el-form-item>
					<el-form-item label="最后学位" prop="lastestEducation" style="margin-left: 180px;">
						<el-input v-model="form.lastestEducation" placeholder="请输入最后学位" />
					</el-form-item>
					<el-form-item label="学位授予院校" prop="awardingInstitutions" style="margin-left: 80px;">
						<el-input v-model="form.awardingInstitutions" placeholder="请输入学位授予院校" />
					</el-form-item>
					<br>
					<el-form-item label="电子邮箱" prop="email">
						<el-input v-model="form.email" placeholder="请输入电子邮箱" />
					</el-form-item>
					<el-divider content-position="center">带班情况</el-divider>
					<el-row :gutter="10" class="mb8">
						<el-col :span="1.5">
							<el-button type="primary" icon="el-icon-plus" size="mini"
								@click="handleAddSysTeacherTakeclass">添加</el-button>
						</el-col>
						<el-col :span="1.5">
							<el-button type="danger" icon="el-icon-delete" size="mini"
								@click="handleDeleteSysTeacherTakeclass">删除</el-button>
						</el-col>
					</el-row>
					<el-table :data="sysTeacherTakeclassList" :row-class-name="rowSysTeacherTakeclassIndex"
						@selection-change="handleSysTeacherTakeclassSelectionChange" ref="sysTeacherTakeclass">
						<el-table-column type="selection" width="50" align="center" />
						<el-table-column label="序号" align="center" prop="index" width="50" />
						<el-table-column label="带班学院" prop="college" width="150">
							<template slot-scope="scope">
								<el-select v-model="scope.row.college" @change="getGrade(scope.row)" placeholder="请选择带班学院">
									<el-option v-for="item in collegeList" :key="item.label" :label="item.label"
									    :value="item.label">
									</el-option>
								</el-select>
							</template>
						</el-table-column>
						<el-table-column label="带班年级" prop="grade" width="150">
							<template slot-scope="scope">
								<el-select v-model="scope.row.grade" @change="getClass(scope.row)" :disabled="scope.row.setGrade" placeholder="请选择带班年级">
										<el-option v-for="item in gradeList" :label="item.gradeName"
                            :value="item.gradeName">
										</el-option>
								</el-select>
							</template>
						</el-table-column>
						<el-table-column label="带班班级" prop="classteam" width="150">
							<template slot-scope="scope">
								
								<el-select v-model="scope.row.classteam" :disabled="scope.row.setClass" placeholder="请选择带班班级">
									<el-option v-for="item in classList" :label="item.className"
									    :value="item.className">
									</el-option>
								</el-select>
							</template>
						</el-table-column>
						<el-table-column label="带班人数" prop="number" width="150">
							<template slot-scope="scope">
								<el-input v-model="scope.row.number" placeholder="请输入带班人数" />
							</template>
						</el-table-column>
					</el-table>
				</el-form>

				<el-button type="primary" @click="submitForm" style="margin-left: 75%;">保 存</el-button>
				<el-button @click="cancel" style="margin-left: 5%;">重置</el-button>

				<!-- </el-dialog> -->
			</el-tab-pane>
			<el-tab-pane label="学业成长" >
				<study></study>
			</el-tab-pane>
			<el-tab-pane label="学习培训">
				<training></training>
			</el-tab-pane>
			<el-tab-pane label="职业资格">
				<certificate></certificate>
			</el-tab-pane>
			<el-tab-pane label="岗位锻炼">
				<exercise></exercise>
			</el-tab-pane>
			<el-tab-pane label="课程教学">
				<course></course>
			</el-tab-pane>
			<el-tab-pane label="论文成果">
				<thesis @canSubmit="getSubmit"></thesis>
			</el-tab-pane>
			<el-tab-pane label="课题研究">
				<research @canSubmit="getSubmit"></research>
			</el-tab-pane>
			<el-tab-pane label="工作案例">
				<workexample @canSubmit="getSubmit"></workexample>
			</el-tab-pane>
			<el-tab-pane label="指导参赛">
				<guidance @canSubmit="getSubmit"></guidance>
			</el-tab-pane>
			<el-tab-pane label="个人参赛">
				<contest @canSubmit="getSubmit"></contest>
			</el-tab-pane>
			<el-tab-pane label="个人荣誉">
				<honor @canSubmit="getSubmit"></honor>
			</el-tab-pane>
			<el-tab-pane label="考核评价">
				<appraise></appraise>
			</el-tab-pane>
		</el-tabs>

		<!-- <div slot="footer" class="dialog-footer">
     <el-button type="primary" @click="submitForm">保 存</el-button>
     <el-button @click="cancel">重 置</el-button>
   </div> -->

	</div>
</template>

<script>
	import {
		listBasicmessage,
		getBasicmessage,
		delBasicmessage,
		addBasicmessage,
		updateBasicmessage
	} from "@/api/teacher/basicmessage";
	import {
		getUserProfile
	} from "@/api/system/user";
	//辅导员学业成长组件
	import study from '@/views/teacher/basicmessage/study/index.vue'
	//辅导员学习培训组件
	import training from '@/views/teacher/basicmessage/training/index.vue'
	//辅导员学习培训组件
	import certificate from '@/views/teacher/basicmessage/certificate/index.vue'
	//辅导员岗位锻炼组件
	import exercise from '@/views/teacher/basicmessage/exercise/index.vue'
	//辅导员课程教学组件
	import course from '@/views/teacher/basicmessage/course/index.vue'
	//辅导员论文成果组件
	import thesis from '@/views/teacher/basicmessage/thesis/index.vue'
	//辅导员课题研究组件
	import research from '@/views/teacher/basicmessage/research/index.vue'
	//辅导员工作案例组件
	import workexample from '@/views/teacher/basicmessage/workexample/index.vue'
	//辅导员指导参赛组件
	import guidance from '@/views/teacher/basicmessage/guidance/index.vue'
	//辅导员个人参赛组件
	import contest from '@/views/teacher/basicmessage/contest/index.vue'
	//辅导员个人荣誉组件
	import honor from '@/views/teacher/basicmessage/honor/index.vue'
	//辅导员考核评价组件
	import appraise from '@/views/teacher/basicmessage/appraise/index.vue'
	import {
			listAchievementcheck,
			getAchievementcheck,
			addAchievementcheck,
			updateAchievementcheck,
			delAchievementcheck
		} from "@/api/teacher/achievementcheck";
	//获取学院、年级、班级信息
	import { listClass, getClass, delClass, addClass, updateClass, getMajorsName } from "@/api/stuCQS/basedata/class";
	import { listGrade, getGrade, queryGrade } from "@/api/stuCQS/basedata/grade";
	import { getDeptName } from "@/api/system/dept";
	export default {
		name: "Basicmessage",
		dicts: ['rt_nature', 'rt_political', 'rt_nation', 'rt_college', 'rt_grade', 'rt_classes','rt_filling_college'],
		components: {
			study,
			training,
			certificate,
			exercise,
			course,
			thesis,
			research,
			workexample,
			guidance,
			contest,
			honor,
			appraise
			
		},
		data() {
			//通用校验
			const validateAwardTime = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("不能为空"));
      }
      if (value.trim() === "") {
        return callback(new Error("不能仅包含空格"));
      }
      callback();
    };
	//手机号校验
	const validatePhone = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("不能为空"));
      }
      if (value.trim() === "") {
        return callback(new Error("不能仅包含空格"));
      }
	  if (isNaN(value)) {
        return callback(new Error("请输入常规数字"));
      }
	  if(value.indexOf(".")!=-1){
		return callback(new Error("不能为小数"));
	  }
	  if(value.indexOf("-")!=-1){
		return callback(new Error("不能为负数"));
	  }
	  if(value.length!=11){
		return callback(new Error("请输入11位手机号"));
	  }
	
      callback();
    };
	//微信账号校验
	const validateWechat = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("不能为空"));
      }
      if (value.trim() === "") {
        return callback(new Error("不能仅包含空格"));
      }
	  if (/[\u4e00-\u9fa5]/.test(value)) {
        return callback(new Error("不能含汉字"));
      }
	const regex = /^[a-zA-Z_][a-zA-Z0-9_-]{5,19}$/;
      if (!regex.test(value)) {
        return callback(new Error("必须以字母或下划线开头的微信格式"));
      }
      callback();
    };
	//身份证号码校验
	const validateIdentity = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("不能为空"));
      }
      if (value.trim() === "") {
        return callback(new Error("不能仅包含空格"));
      }
	  if (isNaN(value)) {
        return callback(new Error("请输入数字"));
      }
	  if(value.indexOf(".")!=-1){
		return callback(new Error("不能为小数"));
	  }
      if(value.indexOf("-")!=-1){
		return callback(new Error("不能为负数"));
	  }
	  if(value.length!=15 && value.length!=18){
		return callback(new Error("请输入15位或18位的手机号"));
	  }
	  
      callback();
    };
	//QQ号码校验
	const validateQqnumber = (rule, value, callback) => {
		if (!value) {
        return callback(new Error("不能为空"));
      }
      if (value.trim() === "") {
        return callback(new Error("不能仅包含空格"));
      }
	  if (isNaN(value)) {
        return callback(new Error("请输入常规数字"));
      }
	  if(value.indexOf(".")!=-1){
		return callback(new Error("不能为小数"));
	  }
	  if(value.indexOf("-")!=-1){
		return callback(new Error("不能为负数"));
	  }
	  if(value.length<5){
		return callback(new Error("请输入5位以上的QQ号"));
	  }
	  
      callback();
    };
			return {
				//用户信息
				user: {},
				//是否允许设置年级、学院
				setGrade:true,
				grade:[],
				setClass:true,
				class:[],
				//是否允许提交
				canSubmit:false,
				// 当前辅导员ID
				currentId: null,
				//当前辅导员姓名、学院
				currentName:null,
				currentCollege:null,
				// 遮罩层
				loading: true,
				// 选中数组
				ids: [],
				// 子表选中数据
				checkedSysTeacherTakeclass: [],
				// 非单个禁用
				single: true,
				// 非多个禁用
				multiple: true,
				// 显示搜索条件
				showSearch: true,
				// 总条数
				total: 0,
				// basicMessage表格数据
				basicmessageList: [],
				// takeClass表格数据
				sysTeacherTakeclassList: [],
				// study表格数据
				studyList: [],
				// 弹出层标题
				title: "",
				// 是否显示弹出层
				open: false,
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					name: null,
					gender: null,
					birthday: null,
					nation: null,
					photo: null,
					political: null,
					wechat: null,
					address: null,
					identity: null,
					qqnumber: null,
					marriage: null,
					anotherDuties: null,
					level2units: null,
					serviceHours: null,
					jobNature: null,
					joinWorkHours: null,
					highestEducation: null,
					educated: null,
					study: null,
					lastestEducation: null,
					awardingInstitutions: null,
					email: null,
					college:null,

				},
				// 表单参数
				form: {},
				// 表单校验
				rules: {
					teacherId: [{ validator: validateAwardTime, trigger: "blur" }],
					name: [{ validator: validateAwardTime, trigger: "blur" }],
					gender: [{ validator: validateAwardTime, trigger: "blur" }],
					birthday: [{ validator: validateAwardTime, trigger: "blur" }],
					nation: [{ validator: validateAwardTime, trigger: "blur" }],
					photo: [{ validator: validateAwardTime, trigger: "blur" }],
					political: [{ validator: validateAwardTime, trigger: "blur" }],
					wechat: [{ validator: validateWechat, trigger: "blur" }],
					address: [{ validator: validateAwardTime, trigger: "blur" }],
					identity: [{ validator: validateIdentity, trigger: "blur" }],
					qqnumber: [{ validator: validateQqnumber, trigger: "blur" }],
					marriage: [{ validator: validateAwardTime, trigger: "blur" }],
					anotherDuties: [{ validator: validateAwardTime, trigger: "blur" }],
					level2units: [{ validator: validateAwardTime, trigger: "blur" }],
					serviceHours: [{ validator: validateAwardTime, trigger: "blur" }],
					jobNature: [{ validator: validateAwardTime, trigger: "blur" }],
					joinWorkHours: [{ validator: validateAwardTime, trigger: "blur" }],
					highestEducation: [{ validator: validateAwardTime, trigger: "blur" }],
					educated: [{ validator: validateAwardTime, trigger: "blur" }],
					study: [{ validator: validateAwardTime, trigger: "blur" }],
					lastestEducation: [{ validator: validateAwardTime, trigger: "blur" }],
					awardingInstitutions: [{ validator: validateAwardTime, trigger: "blur" }],
					email: [{ validator: validateAwardTime, trigger: "blur" }],
					phone: [{ validator: validatePhone, trigger: "blur" }],
				},
				collegeList:[],//学院列表
				gradeList: [],//年级列表
				classList: [],//班级列表
			};
		},
		created() {
			this.getList();
			this.getUser();
		},
		methods: {
			/** 查询basicMessage列表 */
			getList() {
				//获取学院名称列表
				getDeptName().then(res => {
				    this.collegeList = res.data;
					
				})
				
				//获取年级名称列表
				listGrade().then(res => {
				    this.gradeList = res.rows;
					
				})
				
				
				
				this.loading = true;
				listBasicmessage(this.queryParams).then(response => {
					this.basicmessageList = response.rows;
					this.total = response.total;
					this.loading = false;
				});
			},
			// 取消按钮
			cancel() {
				this.open = false;
				this.reset();
			},
			// 表单重置
			reset() {
				this.form = {
					teacherId: null,
					name: null,
					gender: null,
					birthday: null,
					nation: null,
					photo: null,
					political: null,
					wechat: null,
					address: null,
					identity: null,
					qqnumber: null,
					marriage: null,
					anotherDuties: null,
					level2units: null,
					serviceHours: null,
					jobNature: null,
					joinWorkHours: null,
					highestEducation: null,
					educated: null,
					study: null,
					lastestEducation: null,
					awardingInstitutions: null,
					email: null,

				};
				this.sysTeacherTakeclassList = [];
				this.resetForm("form");
			},
			/** 搜索按钮操作 */
			handleQuery() {
				this.queryParams.pageNum = 1;
				this.getList();
			},
			/** 重置按钮操作 */
			resetQuery() {
				this.resetForm("queryForm");
				this.handleQuery();
			},
			// 多选框选中数据
			handleSelectionChange(selection) {
				this.ids = selection.map(item => item.teacherId)
				this.single = selection.length !== 1
				this.multiple = !selection.length
			},
			/** 新增按钮操作 */
			handleAdd() {
				this.reset();
				this.open = true;
				this.title = "添加基础信息";
			},
			/** 修改按钮操作 */
			handleUpdate(row) {
				this.reset();
				const teacherId = row.teacherId || this.ids
				getBasicmessage(teacherId).then(response => {
					this.form = response.data;
					this.sysTeacherTakeclassList = response.data.sysTeacherTakeclassList;
					this.open = true;
					this.title = "修改基础信息";
				});
			},
			/** 提交按钮 */
			submitForm() {
				this.$refs["form"].validate(valid => {
					if (valid) {
						this.form.sysTeacherTakeclassList = this.sysTeacherTakeclassList;
						if (this.title == "修改基础信息") {
							updateBasicmessage(this.form).then(response => {
								this.$modal.msgSuccess("修改成功");
								
								this.open = false;
								this.getList();
								this.getUser();
							});
						} else if(this.title == "添加基础信息"){
							
							addBasicmessage(this.form).then(response => {
								this.$modal.msgSuccess("执行成功");
								
								this.open = false;
								this.getList();
								this.getUser();
							});
						}
					}
				});
			},
			/** 删除按钮操作 */
			handleDelete(row) {
				const teacherIds = row.teacherId || this.ids;
				this.$modal.confirm('是否确认删除基础信息编号为"' + teacherIds + '"的数据项？').then(function() {
					return delBasicmessage(teacherIds);
				}).then(() => {
					this.getList();
					this.$modal.msgSuccess("删除成功");
				}).catch(() => {});
			},
			/** takeClass序号 */
			rowSysTeacherTakeclassIndex({
				row,
				rowIndex
			}) {
				row.index = rowIndex + 1;
			},
			/** takeClass添加按钮操作 */
			handleAddSysTeacherTakeclass() {
				let obj = {};
				obj.college = "";
				obj.grade = "";
				obj.classteam = "";
				obj.number = "";
				obj.setGrade=true;
				obj.setClass=true;
				this.sysTeacherTakeclassList.push(obj);
			},
			/** takeClass删除按钮操作 */
			handleDeleteSysTeacherTakeclass() {
				if (this.checkedSysTeacherTakeclass.length == 0) {
					this.$modal.msgError("请先选择要删除的带班信息数据");
				} else {
					const sysTeacherTakeclassList = this.sysTeacherTakeclassList;
					const checkedSysTeacherTakeclass = this.checkedSysTeacherTakeclass;
					this.sysTeacherTakeclassList = sysTeacherTakeclassList.filter(function(item) {
						return checkedSysTeacherTakeclass.indexOf(item.index) == -1
					});
				}
			},
			/** 复选框选中数据 */
			handleSysTeacherTakeclassSelectionChange(selection) {
				this.checkedSysTeacherTakeclass = selection.map(item => item.index)
			},
			/** 导出按钮操作 */
			handleExport() {
				this.download('teacher/basicmessage/export', {
					...this.queryParams
				}, `basicmessage_${new Date().getTime()}.xlsx`)
			},
			//获取用户信息
			getUser() {
				getUserProfile().then(response => {
					this.user = response.data;
					
					this.currentName=this.user.nickName;
					this.currentCollege=this.user.dept.deptName;
					var teacherIds;
					if(this.user.userName=="admin"){
						teacherIds = 1;
						this.currentId = 1;
					}else{
						teacherIds = parseInt(this.user.userName);
						this.currentId = parseInt(this.user.userName);
					}
					
			
					let userMessage = {
						teacherId:teacherIds,
						// teacherId:100,
						name:this.user.nickName,
						phone:this.user.phonenumber,
						email:this.user.email,
						gender:this.user.sex
					}
					
					getBasicmessage(teacherIds).then(response => {
						if (response.data != undefined) {
							this.form = response.data;
							this.sysTeacherTakeclassList = response.data.sysTeacherTakeclassList;
							this.open = true;
							this.title = "修改基础信息";
						} else {
							this.form=userMessage;
							
							this.open = true;
							this.title = "添加基础信息";
						}
					});
				});

			},
			getClass(row){
				
				var c = this;
				if(row.grade!=null){
					row.setClass=false;
				}else{
					row.setGrade=true;
					row.setClass=true;
				}
				c.classList=[];
				
				var take= {
					pageSize: 100,
				    majorId: null,
				    className: null,
				    deptId: null,
				    status: null,
				    gradeId: null,
				};
				var gId = {
					gradeName:row.grade
				}
				queryGrade(gId).then(response => {
					take.gradeId = response.rows[0].gradeId;
					listClass(take).then(response => {
						for(var i =0;i<take.pageSize;i++){
							// console.log(response.rows[i].dept.deptName);
							if(row.college==response.rows[i].dept.deptName){
								c.classList.push({
									classId:response.rows[i].classId,
									className:response.rows[i].className
								})
							}
						}
						
					});
				});
				
				
			},
			getGrade(row){
				if(row.college!=null){
					row.setGrade=false;
					var c = this;
					c.classList=[];
					var take= {
						pageSize: 100,
					    majorId: null,
					    className: null,
					    deptId: null,
					    status: null,
					    gradeId: null,
					};
					var gId = {
						gradeName:row.grade
					}
					queryGrade(gId).then(response => {
						take.gradeId = response.rows[0].gradeId;
						listClass(take).then(response => {
							for(var i =0;i<take.pageSize;i++){
								// console.log(response.rows[i].dept.deptName);
								if(row.college==response.rows[i].dept.deptName){
									c.classList.push({
										classId:response.rows[i].classId,
										className:response.rows[i].className
									})
								}
							}
							
						});
						});
					
				}else{
					row.setGrade=true;
					row.setClass=true;
				}
			},
			submitCheck(){
				this.loading = true;
				var c = this;
				var achievementQuery = {
						        teacherId: c.form.teacherId
								// checkStatus:1
					}
				listAchievementcheck(achievementQuery).then(response => {
					c.loading = false;
					if(response.rows.length==0){
						c.$modal.confirm('确认提交今年成果绩效？').then(function() {
							var achievement = {
								checkId: null,
								        teacherId: c.currentId,
								        teacherName: c.currentName,
								        teacherCollege: c.currentCollege,
								        checkYear: new Date().getFullYear(),
										submitTime: new Date(),
										checkStatus:1
							}
							addAchievementcheck(achievement).then(response=>{
								c.$modal.msgSuccess("提交审核成功");
								c.canSubmit=true;
								c.getList();
							})
						}).then(() => {
							
						}).catch(() => {});
						
					}else{
						c.$modal.confirm('确认提交修改？').then(function() {
							var ck = response.rows[0];
							ck.checkStatus = 1;
							ck.checkPerson = "";
							ck.returnReason = "";
							updateAchievementcheck(ck).then(response => {
							c.$modal.msgSuccess("修改审核成功");
							c.canSubmit=true;
							c.getList();
							});
							
						}).then(() => {
							
						}).catch(() => {});
					}
				})
			},
			getSubmit(data){
				this.canSubmit = data.message;
			}
			
		}
	};
</script>
<style>
	.el-divider__text {
		font-size: 20px;
		font-weight: bold;
	}
</style>